package com.leo.quartz.entity;


import com.leo.base.AbstractEntity;
import com.leo.quartz.common.lang.RunStatusEnum;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "leo_trigger",
        uniqueConstraints=@UniqueConstraint(name = "triggerKey", columnNames={"id", "job_id"}))
public class TriggerPO extends AbstractEntity implements Serializable {

    private Long jobId;
    private String jobKey;
    private TriggerType triggerType;
    private String triggerKey;
    private String triggerDesc;
    private RunStatusEnum triggerStatus;
    private String triggerRule;


    @Basic
    @Column(name = "job_id")
    public Long getJobId() {
        return jobId;
    }

    public void setJobId(Long jobId) {
        this.jobId = jobId;
    }

    @Basic
    @Column(name = "job_key")
    public String getJobKey() {
        return jobKey;
    }

    public void setJobKey(String jobKey) {
        this.jobKey = jobKey;
    }

    @Basic
    @Column(name = "trigger_type")
    @Enumerated
    public TriggerType getTriggerType() {
        return triggerType;
    }

    public void setTriggerType(TriggerType triggerType) {
        this.triggerType = triggerType;
    }

    @Basic
    @Column(name = "trigger_key")
    public String getTriggerKey() {
        return triggerKey;
    }

    public void setTriggerKey(String triggerKey) {
        this.triggerKey = triggerKey;
    }

    @Basic
    @Column(name = "trigger_desc")
    public String getTriggerDesc() {
        return triggerDesc;
    }

    public void setTriggerDesc(String triggerDesc) {
        this.triggerDesc = triggerDesc;
    }

    @Basic
    @Column(name = "trigger_status")
    @Enumerated
    public RunStatusEnum getTriggerStatus() {
        return triggerStatus;
    }

    public void setTriggerStatus(RunStatusEnum triggerStatus) {
        this.triggerStatus = triggerStatus;
    }

    @Basic
    @Column(name = "trigger_rule")
    public String getTriggerRule() {
        return triggerRule;
    }

    public void setTriggerRule(String triggerRule) {
        this.triggerRule = triggerRule;
    }

    public enum TriggerType {
         /**/
        SIMPLE, CRON;
    }

}
